<%@ page language="java" pageEncoding="utf-8"%>
<form action="${ctx }/user/user.action" id="setting_form" method="post">
	<div style="margin: 0; padding: 0; display: inline">
		<input type="hidden" name="user.id" value="${me.id}" />
		<input type="hidden" name="type" value="${param.type}"/>
	</div>
	<fieldset>
		<ul id="email">
			<li><label for="old_email">旧邮件地址</label> <input type="text"
				name="old_email" id="old_email" class="text" value="${param.old_email }">
			</li>
			<li><label for="email">新邮件地址</label> <input type="text"
				class="text" name="new_email" id="new_email" value="${param.new_email }">(改变邮件地址需要激活)
			</li>
			<li>如果您忘记旧的邮件地址，请给管理员发Email：liuzhengqiu1127<img alt="Email"
				src="${ctx}/img/email.gif">163.com ，报告你的帐号ID</li>
		</ul>
	</fieldset>
	<div style="text-align: center;">
		<input id="submit_button" class="submit" type="submit" value="提交"
			onclick="return beforeSubmit();" name="method:save">
	</div>
</form>
<script type="text/javascript">
$(function(){
	reg = /^\w+@\w+(\.[a-zA-Z]{2,3})+$/;
	$("#old_email").blur(function(){
		old_email = $("#old_email").val();
		if(old_email.length==0||!reg.test(old_email)){
			$("#old_email").css("border","3px solid #FF0000"); 
			$("#old_email").attr("title","fail");
			}else{
				$("#old_email").css("border","1px solid #006699");
			}
	});
	$("#new_email").blur(function(){
		new_email = $("#new_email").val();
		if(new_email.length==0||!reg.test(new_email)){
			$("#new_email").css("border","3px solid #FF0000"); 
			$("#old_email").attr("title","fail");
			}else{
				$("#new_email").css("border","1px solid #006699");
			}
	});
});
function beforeSubmit(){
	var flag = true;
	$("#email input").each(function(){
		title = $(this).attr("title");
		value = $(this).val();
		if(value.length==0){
			flag = false;
			return fasle;
		}
		if(title=="fail"){
			flag = false;
			return false;
		}
	});
	return flag;
}
</script>